home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0786.arc
/
PILOT4.LTG
< prev
next >
Wrap
Text File
|
1986-04-28
|
1KB
|
42 lines
Listing #4
The Parse Routine
parse(line)
char *line;
{
/** Parse line, calling the appropriate routine depending on
the statement type. **/
register int i=0;
char *lineptr, buffer[SLEN];
while (whitespace(line[i])) i++; /* skip leading blanks */
lineptr = (char *) line + i+1; /* ...skip first char */
error = NOERROR; /* each line is new! */
switch (toupper(line[i])) {
case 'A' : accept(lineptr); break;
case 'C' : compute(lineptr); break;
case 'E' : endit(lineptr); break;
case 'J' : jump(lineptr); break;
case 'M' : match(lineptr); break;
case 'R' : /** remark **/ break;
case 'T' : type(lineptr); break;
case 'U' : use(lineptr); break;
case '*' : label(line, current_line); break;
case ':' : sprintf(buffer, "%c%s", boolean_cont==boolean? 'Y' : 'N',
line);
type(buffer); break;
default :
raise_error(UNKNOWN_STATEMENT, NONFATAL, line);
}
}